home *** CD-ROM | disk | FTP | other *** search
-
-
-
- ddddmmmmIIIICCCC((((3333ddddmmmm)))) ddddmmmmIIIICCCC((((3333ddddmmmm))))
-
-
-
- NNNNAAAAMMMMEEEE
- ddddmmmmIIIICCCCWWWWoooorrrrkkkk,,,, - call the image converter and have it perform a task
-
- SSSSYYYYNNNNOOOOPPPPSSSSIIIISSSS
- ####iiiinnnncccclllluuuuddddeeee <<<<ddddmmmmeeeeddddiiiiaaaa////ddddmmmm____iiiimmmmaaaaggggeeeeccccoooonnnnvvvveeeerrrrtttt....hhhh>>>>
-
- DDDDMMMMssssttttaaaattttuuuussss ddddmmmmIIIICCCCWWWWoooorrrrkkkk((((DDDDMMMMiiiimmmmaaaaggggeeeeccccoooonnnnvvvveeeerrrrtttteeeerrrr ccccoooonnnnvvvveeeerrrrtttteeeerrrr,,,, iiiinnnntttt ****ssssttttaaaattttuuuussss____ffffllllaaaaggggssss,,,,
- iiiinnnntttt ****nnnn____iiiinnnnppppuuuutttt____ddddeeeeqqqquuuueeeeuuuueeeedddd,,,, iiiinnnntttt ****nnnn____oooouuuuttttppppuuuutttt____eeeennnnqqqquuuueeeeuuuueeeedddd))));;;;
-
- PPPPAAAARRRRAAAAMMMMEEEETTTTEEEERRRRSSSS
- This function calls into the image converter and has it perform a task
- (such as a compress or uncompress) on the buffers that have previously
- been sent to it using dmICSend.
-
- _c_o_n_v_e_r_t_e_r the converter instance
-
- _s_t_a_t_u_s__f_l_a_g_s bit field flags returning information about what transpired
- during the dmICWork call, especially in the event of an
- error. Flags include: DM_IC_WORK_NO_STATUS,
- DM_IC_WORK_ERROR, DM_IC_WORK_NOT_NEEDED,
- DM_IC_WORK_INSUFFICIENT_INPUT_DATA, and
- DM_IC_WORK_INSUFFICIENT_OUTPUT_SPACE.
-
- _n__i_n_p_u_t__d_e_q_u_e_u_e_d
- the number of source buffers dequeued by this dmICWork call
-
- _n__o_u_t_p_u_t__e_n_q_u_e_u_e_d
- the number of output buffers enqueued by this dmICWork call
-
- DDDDEEEESSSSCCCCRRRRIIIIPPPPTTTTIIIIOOOONNNN
- This call will have the converter actually perform the conversion on the
- srcBuffer previously sent by ddddmmmmIIIICCCCSSSSeeeennnndddd. Note that this call is only
- necessary if the default threaded model of dmIC has been turned off, so
- that there is only one thread. This is done by setting a DM_IC_THREADS
- dmParam to be DM_IC_THREADS_DISABLED, and then calling ddddmmmmIIIICCCCSSSSeeeettttCCCCoooonnnnvvvvPPPPaaaarrrraaaammmmssss
- on the DMimageconverter immediately after it is created with ddddmmmmIIIICCCCCCCCrrrreeeeaaaatttteeee.
- See the source code example below.
-
- ddddmmmmIIIICCCCWWWWoooorrrrkkkk is a synchronous operation. When ddddmmmmIIIICCCCWWWWoooorrrrkkkk returns, the
- conversion is finished, and ddddmmmmIIIICCCCRRRReeeecccceeeeiiiivvvveeee can be used to pick up the output
- if an output buffer has been enqueued.
-
- ddddmmmmIIIICCCCWWWWoooorrrrkkkk must NOT be called in the default threaded dmIC model.
-
- ddddmmmmIIIICCCCWWWWoooorrrrkkkk will attempt to do the smallest amount of work possible while
- still achieving something. For the vast majority of image converters,
- this means it dequeues exactly one buffer, compresses or uncompresses
- that buffer, and enqueues exactly one result buffer.
-
- Several types of errors can occur in ddddmmmmIIIICCCCWWWWoooorrrrkkkk, and these will result
- various status flags being returned. For example, the input queue could
- be empty (DM_IC_WORK_INSUFFICIENT_INPUT_DATA), or the output queue could
-
-
-
- PPPPaaaaggggeeee 1111
-
-
-
-
-
-
- ddddmmmmIIIICCCC((((3333ddddmmmm)))) ddddmmmmIIIICCCC((((3333ddddmmmm))))
-
-
-
- be full (DM_IC_WORK_INSUFFICIENT_OUTPUT_SPACE). In the case of a
- hardware accelerated image converter, ddddmmmmIIIICCCCWWWWoooorrrrkkkk will return DM_SUCCESS,
- and will also set the status flag to be DM_IC_WORK_NOT_NEEDED, since the
- hardware has already performed the task. In this case there will be no
- buffers dequeued or enqueued.
-
- EEEEXXXXAAAAMMMMPPPPLLLLEEEE
- The following source code suppresses the default threaded behavior of
- dmIC, and uses the ddddmmmmIIIICCCCWWWWoooorrrrkkkk function to perform the tasks that by default
- would have been done by a separate thread:
-
- /*
- * Create the image converter from the index
- */
- if (dmICCreate(convIndex, &imageConverter) != DM_SUCCESS)
- fatal("dmICCreate failed for our imageConverter");
-
- ... some code not included ...
-
- /*
- * Set the "disable sproc" converter param
- */
- dmParamsCreate(&cPrms);
- dmParamsSetEnum(cPrms, DM_IC_THREADS, DM_IC_THREADS_DISABLED);
- if (dmICSetConvParams(imageConverter, cPrms) != DM_SUCCESS)
- fatal("should never occur");
-
- ... some code not included ...
-
- if (dmICSend(imageConverter, srcBuf, NULL, NULL) != DM_SUCCESS)
- fatal("dmICSend failed");
- dmBufferFree(srcBuf);
-
- if (dmICWork(imageConverter, &status, &nIn, &nOut) != DM_SUCCESS)
- fatal("dmICWork failed");
-
- ... use system call "select()" here to wait for results ...
-
- if (dmICReceive(imageConverter, &dstBuf) != DM_SUCCESS)
- fatal("dmICReceive failed");
-
-
- SSSSEEEEEEEE AAAALLLLSSSSOOOO
- dmBufferAllocate(3dm), dmICSend(3dm), dmICSetSrcParams(3dm),
- dmICSetDstParams(3dm), dmICSetConvParams(3dm), dmICReceive(3dm).
-
-
-
-
-
-
-
-
-
-
- PPPPaaaaggggeeee 2222
-
-
-
-